package com.jinhongone.pattern.behavior.memento.white_memento;

/**
 * 游戏角色类（发起人角色）
 */
public class GameRole {
    private int vit; //生命力
    private int atk; //攻击力
    private int def; //防御力

    //初始状态
    public void initState() {
        this.vit = 100;
        this.atk = 100;
        this.def = 100;
    }

    //战斗后状态
    public void fight() {
        this.vit = 0;
        this.atk = 0;
        this.def = 0;
    }

    //展示当前状态
    public void stateDisplay() {
        System.out.println("当前生命值：" + this.vit);
        System.out.println("当前攻击力：" + this.atk);
        System.out.println("当前防御力：" + this.def);
    }

    //状态保持
    public RoleStateMemento saveState() {
        return new RoleStateMemento(this.vit, this.atk, this.def);
    }

    //恢复状态
    public void recoverState(RoleStateMemento memento) {
        this.vit = memento.getVit();
        this.atk = memento.getAtk();
        this.def = memento.getDef();
    }

    public GameRole() {
    }


}
